package com.coolingme.message;

import com.coolingme.message.degree.NormalMessage;
import com.coolingme.message.degree.UrgencyMessage;
import com.coolingme.message.typeimpl.EmailMessage;
import com.coolingme.message.typeimpl.SmsMessage;

/**
 * 桥接模式测试
 * <p>
 * 分为信息类型和信息紧急程度两个维度，AbstractMessage作为桥接
 *
 * @author wangyue
 * @date 2020-09-20 21:30
 */
public class Test {

    public static void main(String[] args) {
        // 普通的邮箱信息
        IMessage emailMessage = new EmailMessage();
        NormalMessage normalMessage = new NormalMessage(emailMessage);
        normalMessage.sendMessage("Long time no see", "白展堂");

        System.out.println("--------------");

        // 紧急的短信信息
        IMessage smsMessage = new SmsMessage();
        UrgencyMessage urgencyMessage = new UrgencyMessage(smsMessage);
        urgencyMessage.sendMessage("好久不见", "江湖");
    }

}
